<?php
$n = $_GET["n"];
$p = $_GET["p"];


$servername = "localhost";
$username = "root";
$password = "root";
$dbname = "db5";
 
// 创建连接
$conn = new mysqli($servername, $username, $password, $dbname);
// 检测连接
if ($conn->connect_error) {
    die("连接失败: " . $conn->connect_error);
} 


 
$sql = "INSERT INTO `user` (`id`, `name`, `password`) VALUES (NULL, '$n', '$p');";
 
if ($conn->query($sql) === TRUE) {
    echo "新记录插入成功";
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}
 
$conn->close();
?>